<template>
  <el-checkbox-group v-model="current">
    <el-checkbox v-for="item in list" :label="item.value">{{item.name}}</el-checkbox>
  </el-checkbox-group>
</template>

<script>
  import waves from '@/directive/waves' // waves directive

  export default {
    name: 'productServiceSelect',
    components: {  },
    directives: { waves },
    filters: {

    },
    props:{
      value: String,
      placeholder: String
    },
    data() {
      return {
        list: [{value: 1, name: '无忧退货'}, {value: 2, name: '快速退款'}, {value: 3, name: '免费包邮'}],
        current: []
      }
    },
    watch: {
      current(newValue) {
        var select = ''
        newValue.forEach(it =>{
          select += it + ','
        })
        this.$emit('input',select.substring(0, select.length-1))
      },
      len(newValue){

      }
    },
    computed: {
      len() {
        var select = []
        if(this.value){
          var its = this.value.split(",")
          its.forEach(it =>{
            select.push(parseInt(it))
          })
        }
        this.current = select
        return this.value
      }
    },
    created() {

    },
    methods: {

    }
  }
</script>

<style lang="scss" scoped>



</style>
